A FONT_HANDLE is a 16 bit value returned from <link linkend="load-font">load_font</link> and used by <link linkend="set-font">set_font</link>. Physically it is a pointer to an entry in the font_table.
A font_structure is a container for the data related to a font, including the <link linkend="font-structure-encoding">encoding data</link> and <link linkend="font-structure-tile-data">tile</link> (bitmap) image data.
Due to the variable length nature of the encoding table and the tile data no default C structure exists.
</para></sect3>
<sect3><title>Format</title>
<para>
A font structure is made up of four fields - the font type, the number of tiles used, the encoding table and the tile data.
The Font type is a single bit that describes the encoding table and the format of
the tile data. The encoding table length is specified by the lower two bits
00: 256 byte encoding table
01: 128 byte encoding table
10 and 11 are reserved.
The third bit (0x04) is used to determine if the tile data is compressed. Many tiles do not use shades of grey, and so can be represented in 8 bytes instead of 16. If bit 2 is set, then the tiles are assumed to be 8 bytes long and are expanded to 16 bytes at the load stage.
num_tiles gives the number of tiles present in the tile data and hence the number of tiles required by the font.
</para></sect4>
<sect4 id="font-structure-encoding"><title>encoding: array of UBYTE</title>
<para>
The encoding table is an array that maps an ASCII character to the appropriate tile in the tile data. For example, suppose that the letter 'A' was the tenth tile. Then the 65th (the ASCII code for 'A') entry in the encoding table would be 10.
Any ASCII characters that don't have a corresponding tile should be mapped to a default tile. Space is recommended tile.
</para></sect4>
<sect4 id="font-structure-tile-data"><title>tile_data: array of UBYTE</title>
<para>
The final field is the actual tile data. Note that tile numbering starts from zero.